{% extends 'easydisAPSBundle::base_template.html.twig' %}

{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('bundles/easydisAPS/css/form.css') }}" type="text/css" media="all" />
    <link rel="stylesheet" href="{{ asset('bundles/easydisAPS/smoothness/jquery-ui-1.10.3.custom.css') }}" />
{% endblock %}

{% block scripts %}
    <script type="text/javascript" src="{{ asset('bundles/easydisAPS/js/jquery-1.10.2.min.js') }}"></script>
    <script src="{{ asset('bundles/easydisAPS/smoothness/jquery-ui-1.10.3.custom.js') }}"></script>
    <script type="text/javascript" src="{{ asset('bundles/easydisAPS/js/datepickerFR.js') }}"></script>
    
    <script>
        
        $(function(){
            $('#date').datepicker();
        });
        
    </script>
{% endblock %}
    
{% block position %}
    <a href="{{ path('easydisAPSBundle_dashboard', {'date':dateC,'mode':'PO','exploit':app.user.exploit.id}) }}" title="Retour au Tableau prévisionnel" class="tip-bottom"><i class="icon-th-list"></i> Tableau prévisionnel</a>
    <a href="#" title="Vous êtes ici" class="tip-bottom"><i class="icon-list-alt"></i> Formulaire de saisie : {{ gs.lib }}</a>
{% endblock %}
    
{% block contenu %}

<form id="madate" name="date" method="post" action="{{ path('easydisAPSBundle_redirect', {'date': dateC,'mode':'add_update','gs': gs.id}) }}">
     <legend style="width: 200px; font-size: 17px; margin-bottom: 10px;"> Modification de la date : </legend>
     <input type="input" name="date" id="date" size="10" readonly="readonly" style="width:100px;"/>
     <button type="submit" class="btn-info">Valider</button>
</form>

<form id="login" name="add_update" method="post" action="{{ path('easydisAPSBundle_dashboard_add_update', {'date': dateC, 'gs': gs.id}) }}"> 

    <h1>Formulaire ajout/modification : {{ gs.lib }}</h1>
    <p class="register" style="color: red; font-weight: bold;">Date courante : {{ dateC }}</p>
    {% set i = 0 %}
    {% for tab in tabResult %}
        {% if tab[0] == 'service'%}
            <div>
               <span class="left">{{ tab[1] }} :</span>
               <span class="right">Objectif</span>
            </div>
        {% elseif tab[0] == 'uo' %}
            <div>
                <label for="element_{{ i }}"> UO : </label> 
                <input size="5px" type="text" id="element_{{ i }}" name="element_{{ i }}" value="{{ tab[1].uoprev }}"/>
                <span class="right">{{ tab[1].uoobj }}</span>
                <input type="hidden" id="type_{{ i }}" name="type_{{ i }}" value="U"/>
                <input type="hidden" id="key_{{ i }}" name="key_{{ i }}" value="{{ tab[2].id }}"/>
            </div>
            {% set i = i + 1 %}
        {% elseif tab[0] == 'heures' %}
            <div>
                <label for="element_{{ i }}"> {{ tab[1].section.lib }} :</label> 
                <input size="5px" type="text" id="element_{{ i }}" name="element_{{ i }}" value="{{ tab[1].hprev }}"/>
                <span class="right">{{ tab[1].hobj|number_format(2) }}</span>
                <input type="hidden" id="type_{{ i }}" name="type_{{ i }}" value="H"/>
                <input type="hidden" id="key_{{ i }}" name="key_{{ i }}" value="{{ tab[1].section.id }}"/>
            </div>
            {% set i = i + 1 %}
        {% elseif tab[0] == 'total' %}
            <div>
                <label for="element_{{ i }}">Productivité :</label> 
                <input size="5px" type="text" id="info_{{ i }}" name="info_{{ i }}" value="{{ tab[1] }}" readonly="readonly"/>
                <span class="right">{{ tab[2] }}</span>
            </div>
        {% endif %}
    {% endfor %}
    <label style="margin-left: 30px" for="element_{{ i }}">Commentaire :</label> 
    <textarea cols="37" id="element_{{ i }}" name="element_{{ i }}">{{ commentaire }}</textarea>
    <input type="hidden" id="type_{{ i }}" name="type_{{ i }}" value="C"/>
    <input type="hidden" id="key_{{ i }}" name="key_{{ i }}" value="{{ gs.id }}"/>
    
    <div class="submit">
        <button type="submit">Valider</button>   
    </div>
    
    <p class="back"><a href="{{ path('easydisAPSBundle_dashboard', {'date':dateC,'mode':'PO','exploit':app.user.exploit.id}) }}">Retour</a></p>
  
</form>

{% endblock %}